<template>
  <div class="con">
    <div class="contbox6_10">
      <p class="titlelist6_10">
        商学院
        <span style="color: #999">&nbsp;&nbsp;/&nbsp;&nbsp;</span>常见问题管理
      </p>
      <div class="content">
        <div class="sousuojg6_10">
          <el-form ref="form" :model="form" label-width="100px">
            <el-form-item label="内容名称" style="float: left;">
              <el-input v-model="form.id"></el-input>
            </el-form-item>
            <el-form-item label="上传人" style="float: left;">
              <el-input v-model="form.id"></el-input>
            </el-form-item>
             <el-form-item label="上传时间">
              <el-date-picker
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="开始日期"
                v-model="form.startDate"
                style="width: 100%"
              ></el-date-picker>
              <div class="times">-</div>
              <el-date-picker
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="结束日期"
                v-model="form.endDate"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
            <el-form-item label="修改时间">
              <el-date-picker
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="开始日期"
                v-model="form.startDate"
                style="width: 100%"
              ></el-date-picker>
              <div class="times">-</div>
              <el-date-picker
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="结束日期"
                v-model="form.endDate"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-form>
        </div>
        <div class="buttons">
          <el-button type="primary" @click="handleSelectLists">搜索</el-button>
          <el-button @click="resetTheSearch">重置</el-button>
           
        </div>
        <el-table
          :data="list"
          tooltip-effect="dark"
          :header-cell-style="{ background: '#F9FAFC', color: '#222' }"
          stripe
          border
          :row-style="{ height: '0px' }"
          :cell-style="{ padding: '0px' }"
          ref="multipleTable"
        >
          <el-table-column min-width="200" label="内容名称" prop="busName"></el-table-column>
          <el-table-column min-width="160" label="上传人" prop="createDate"></el-table-column>
          <el-table-column min-width="160" label="上传时间" prop="createDate"></el-table-column>
          <el-table-column min-width="160" label="修改时间" prop="createDate"></el-table-column>
          <el-table-column show-overflow-tooltip min-width="200" label="操作">
            <template slot-scope="scope">
              <el-button type="text" @click="cat(scope.row)">查看</el-button>
              <el-button type="text" @click="cat1(scope.row)">修改</el-button>
              <el-button type="text" @click="extension(scope.row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div style="font-size: 16px; margin-top: 30px">
          <el-pagination
            style="text-align: right"
            background
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page.sync="form.page"
            :page-sizes="[20, 50, 100]"
            :page-size="form.number"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
          ></el-pagination>
        </div>
      </div>
       <el-dialog
        title="删除确认"
        :visible.sync="dialogFormWindows"
        width="500px"
        :close-on-click-modal="false">
        确认删除该内容？
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormWindows = false">取 消</el-button>
        <el-button type="primary" @click="create('form')">确 定</el-button>
      </div>
    </el-dialog>

    </div>
  </div>
</template>

<script>
import https from "../../plugins/https.js";
import { CompareDate } from "../../assets/js/commion";
export default {
  data() {
    return {
      dialogFormWindows:false,
      val: "",
      total: 0,
      form: {
        status: "",
        startDate: "",
        endDate: "",
        busUid: "",
        page: 1,
        number: 20
      },
      list: [],
      bussinessType: []
    };
  },
  created() {
    this.lists();
  },
  methods: {
    //搜索
    handleSelectLists() {
      this.form.page = 1;
      let bool = CompareDate(this.form.startDate, this.form.endDate);
      if (this.form.startDate != "" && this.form.endDate != "") {
        if (bool) this.getData();
        else this.warrys();
      } else {
        this.lists();
      }
    },
    // 校验时间的一个方法
    warrys() {
      layer.open({
        content: "结束时间不能早于开始时间",
        skin: "msg",
        time: 2 //1秒后自动关闭
      });
    },
    // 重置
    resetTheSearch() {
      this.form = {
        status: "",
        startDate: "",
        endDate: "",
        busUid: "",
        page: 1,
        number: 20
      };
      this.lists();
    },
    //每页几条数据
    handleSizeChange(val) {
      this.SelectData = [];
      this.form.number = val; //动态改变
      this.form.page = 1;
      this.lists();
    },
    //当前页
    handleCurrentChange(val) {
      this.SelectData = [];
      this.form.page = val; //动态改变
      this.lists();
    }
  }
};
</script>

<style scoped>
.con {
  position: relative;
}
/* 单独样式 */
.contbox6_10 {
  width: 100%;
  overflow-x: auto;
  box-sizing: border-box;
  float: left;
}
.sousuojg6_10 {
  width: 100%;
}
.times {
  width: 20px;
  display: inline-block;
  text-align: center;
}
.buttons > .el-button {
  width: 100px;
  padding: 7px;
  height: 32px;
}
</style>